package cn.kongwg.myporxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.security.PrivateKey;
import java.util.Arrays;

/**
 * @author kongwg
 * @create 2021-05-16 10:25
 */
public class Client {
    public static void main(String[] args) {
//        Agent agent = new Agent(new MeleSinger());
//        agent.sing();


        Singer singer = (Singer) Proxy.newProxyInstance(
                Client.class.getClassLoader(),
                MeleSinger.class.getInterfaces(),
                new Agent(new MeleSinger())
        );

        singer.say();
        Class<?>[] interfaces = MeleSinger.class.getInterfaces();
        Class<?>[] ss = Singer.class.getInterfaces();
        System.out.println("interfaces = " + Arrays.toString(interfaces));
        System.out.println("ss = " + Arrays.toString(interfaces));
    }
}
